<template>
  <div class="link-table-piece" @click="handleClick">
    <span>{{ props.text }}</span>
  </div>
</template>
<script lang="ts">
  import { propTypes } from '/@/utils/propTypes';
  import { defineComponent } from 'vue';

  export default defineComponent({
    name: 'LinkTableListPiece',
    props: {
      text: propTypes.string.def(''),
      id: propTypes.string.def(''),
    },
    emits: ['tab'],
    setup(props, { emit }) {
      function handleClick(e) {
        e == null ? void 0 : e.stopPropagation();
        e == null ? void 0 : e.preventDefault();
        console.log(props.id);
        emit('tab', props.id);
      }
      return {
        handleClick,
      };
    },
  });
</script>
<style scoped>
  .link-table-piece {
    color: #333;
    display: inline-block;
    position: relative;
    cursor: pointer;
    background-color: #e8e8e8;
    border-radius: 3px;
    line-height: 21px;
    margin-right: 3px;
    padding: 0 7px;
    max-width: 100px;
  }

  .link-table-piece > span {
    display: inline-block !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
    white-space: nowrap;
  }

  .link-table-piece:hover {
    background-color: #dfebfa;
    color: #2196f3;
  }
</style>
